# -*- coding:utf-8 -*-
from rest_framework.views import APIView
from rest_framework.viewsets import ModelViewSet

from Apps.System.filters.descriptionFilter import DescriptionFilter
from Apps.System.models.description import Description
from Apps.System.ser.descriptionSer import DescriptionSer
from Apps.common.fileUp.file import file_save
from Apps.common.response import SuccessResponse


class DescriptionView(ModelViewSet):
    serializer_class = DescriptionSer
    queryset = Description.objects.all()
    filter_class = DescriptionFilter
    authentication_classes = []


class DescriptionFile(APIView):
    """保存项目图标图像接口"""

    def post(self, request):
        path = file_save(request, "description")
        return SuccessResponse(path)
